C Program to print Pyramid Pattern using star for n number of lines.[Pattern 14]| Using C language| C Program series 35|
👨💻C Program to print Pyramid Pattern (▲) using star for n number of lines.[Pattern:14]
Code :
For n number of LINES:
/*
C Program to print Pyramid Pattern using star for n number of lines.[Pattern 14]
For Example:n=5
*
* *
* * *
* * * *
* * * * *
*/
#include <stdio.h>
main()
{
int i,j,n,temp;
printf("C Program to print Pyramid Pattern using star for n number of lines.[Pattern 14]\n\n");
printf("Enter the number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
temp=n;
for(j=temp-i;j>0;j--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
}
The output of Code:
Comments
Post a Comment